<?php
namespace Admin\Controller;
use Common\Controller\BaseController;
/**
 * 系统设置
 * Class PdAgentController
 * @package Admin\Controller
 */
class PdAgentController extends BaseController{
    const modelName = CONTROLLER_NAME;
    protected function _initialize(){
        parent::_initialize();
        $this->checkAuth();
        $this->model = D(self::modelName);
    }

    /**
     * 列表
     */
    public function index(){
        if(IS_AJAX){
            //获取列表
            $this->create_condition($map);
            $field = 'pk_id,name,level,settlement_propor,create_time';
            $this->data = $this->getRows(self::modelName, $map ,$field ,1);
            $this->rtnResult(0);
        }else{
            $this->showView();
        }
    }

    /**
     * 编辑数据
     */
    public function edit(){
        if (IS_POST){
            $this->editData($this->model,'修改成功|修改失败','index');
        }else {
            //获取详细信息
            $map['pk_id'] = I('pk_id');
            $data['info'] = $this->getDataInfo($this->model, $map);

            //获取角色列表
            $this->showView($data);
        }
    }

    public function add(){
        parent::add();
    }



}
?>
